using System;
using System.Collections.Generic;
using System.Text;

using System.Reflection;

namespace TntOrm
{
    public class AssemblyManager
    {
        private Assembly ObjectsAssembly;

        public void LoadAssembly( string FileName )
        {
            ObjectsAssembly = Assembly.LoadFile( FileName );
        }

        public void SetObjectToOrm( )
        {
            if( ObjectsAssembly == null )
            {
                return;
            }

            Type[] AssemblyTypes = ObjectsAssembly.GetExportedTypes( );

            foreach( Type CurrentType in AssemblyTypes )
            {
                if( CurrentType.BaseType == typeof( TntOrm.OrmDataBaseObject ) )
                {
                    OrmManager.GetInstance( ).AddObject( CurrentType );
                }
            }
        }
    }
}
